import Vue from 'vue';
import Router from 'vue-router';
import Layout from '../layout/index';
import patient from '@/router/plugin/patient.js';
import docWork from '@/router/plugin/docWork.js';
import aid from '@/router/plugin/aid.js';
import caseArr from '@/router/plugin/case.js';
import log from '@/router/plugin/log.js';
import msg from '@/router/plugin/msg.js';
import order from '@/router/plugin/order.js';
import oper from '@/router/plugin/oper.js';
import coust from '@/router/plugin/coust.js';
Vue.use(Router);

export const constantRouterMap = [
  {
    path: '/login',
    meta: { title: '登录', noCache: true },
    component: (resolve) => require(['@/views/login'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/features/404'], resolve),
    hidden: true
  },
  {
    path: '/401',
    component: (resolve) => require(['@/views/features/401'], resolve),
    hidden: true
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: (resolve) => require(['@/views/features/redirect'], resolve)
      }
    ]
  }
];
export const asyncRouterMap = [
  ...aid,
  ...caseArr,
  ...log,
  ...msg,
  ...order,
  ...docWork,
  ...patient,
  ...oper,
  ...coust
];

export default new Router({
  // mode: 'hash',
  mode: 'history',
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
});

// {
//   path: '/user',
//   component: Layout,
//   hidden: true,
//   redirect: 'noredirect',
//   children: [
//     {
//       path: 'center',
//       component: (resolve) => require(['@/views/system/user/center'], resolve),
//       name: '个人中心',
//       meta: { title: '个人中心' }
//     }
//   ]
// }
